//=========================
//自定义验证
function CheckVerifyCode(value, element) {
    var returnVal = false;
    $.ajax({
        type: "POST",
        async: false,
        url: "/Common/Ajax/Ajax_CheckVerifyCode.ashx",
        data: "txtVerifyCode=" + value + "&rnd=" + Math.round(Math.random() * 500),
        beforeSend: function () {
        },
        success: function (data) {
            if (data == "1") {
                returnVal = true;
            }
            else {
                returnVal = false;
            }
        }
    });
    return returnVal;
}

function CheckUserName(value, element) {
    var returnVal = false;
    $.ajax({
        type: "POST",
        async: false,
        url: "/Common/Ajax/Ajax_CheckUserName.ashx",
        data: "txtUserName=" + value + "&rnd=" + Math.round(Math.random() * 500),
        beforeSend: function () {
        },
        success: function (data) {
            if (data == "1") {
                returnVal = true;
            }
            else {
                returnVal = false;
            }
        }
    });
    return returnVal;
}

$f.addMethod("ajaxVerifyCode", function (value, element) {
    return CheckVerifyCode(value, element);
}, "验证码不正确");

$f.addMethod("ajaxUserName", function (value, element) {
    return CheckUserName(value, element);
}, "用户名已存在");

$f.addPattern("chkTel",
    /^((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)$/,
    "请输入正确的联系电话");

